#ifndef __SYS_DEBUG_H
#define __SYS_DEBUG_H

#ifdef __cplusplus
extern "C"
{
#endif
#include <stdio.h>
#include <stdarg.h>
#include <string.h>

#define VA_LIST_BUFF_SIZE 256

#define SYS_LOG 1
#define SYS_DEBUG 1
#define SYS_ERROR 0
#define SYS_WARNING 1

    int printk(const char *format, ...);

#if SYS_LOG
#define SysLog(format, ...)            \
    do                                 \
    {                                  \
        printk("\r\n<log>\r\n");       \
        printk(format, ##__VA_ARGS__); \
    } while (0)
#else
#define SysLog(format, ...)
#endif

#if SYS_DEBUG
#define SysDebug(format, ...)          \
    do                                 \
    {                                  \
        printk("\r\n<debug>\r\n");     \
        printk(format, ##__VA_ARGS__); \
    } while (0)
#else
#define SysDebug(format, ...)
#endif

#if SYS_ERROR
#define SysError(format, ...)                                                     \
    do                                                                            \
    {                                                                             \
        printk("\r\n<error>  %s(%d)-<%s>\r\n", __FILE__, __LINE__, __FUNCTION__); \
        printk("<error>\r\n");                                                    \
        printk(format, ##__VA_ARGS__);                                            \
    } while (0)
#else
#define SysError(format, ...)
#endif

#if SYS_WARNING
#define SysWarning(format, ...)                                                     \
    do                                                                              \
    {                                                                               \
        printk("\r\n<warning>  %s(%d)-<%s>\r\n", __FILE__, __LINE__, __FUNCTION__); \
        printk("<warning>  ");                                                      \
        printk(format, ##__VA_ARGS__);                                              \
    } while (0)
#else
#define SysWarning(format, ...)
#endif

#ifdef __cplusplus
}
#endif

#endif
